#include <stdio.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <string.h>
#include <stdlib.h>

int main(int argc, const char *argv[])
{
	int sockfd=socket(AF_INET,SOCK_STREAM,0);
	struct sockaddr_in serveraddr,clientaddr;
	serveraddr.sin_family=AF_INET;
	serveraddr.sin_addr.s_addr=inet_addr(argv[1]);
	serveraddr.sin_port=htons(atoi(argv[2]));

	socklen_t len=sizeof(serveraddr);
//	bind(sockfd,(struct sockaddr *)&serveraddr,len);

//	listen(sockfd,5);

	connect(sockfd,(struct sockaddr *)&serveraddr,len);
	char sendbuf[128]={0};
	while(1)
	{
		while(1)
		{
			scanf("%s",sendbuf);
			send(sockfd,sendbuf,sizeof(sendbuf),0);
	//	printf("send:%s\n",recvbuf);
			memset(sendbuf,0,128);
		}
	}
	
	return 0;
}
